<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">审核列表</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>用户ID</th>
                                <th>姓名</th>
                                <th>公司</th>
                                <th>部门</th>
                                <th>职位</th>
                                <th>工号</th>
                                <th>备注</th>
                                <th>手机号</th>
                                <th>状态</th>
                                <th>审核时间</th>
                                <th>提交时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><?= $item['user_id'] ?></td>
                                    <td class="am-text-middle"><?= $item['name'] ?></td>
                                    <td class="am-text-middle"><?= $item['company'] ?></td>
                                    <td class="am-text-middle"><?= $item['department'] ?></td>
                                    <td class="am-text-middle"><?= $item['position'] ?></td>
                                    <td class="am-text-middle"><?= $item['job'] ?></td>
                                    <td class="am-text-middle"><?= $item['remark']?></td>
                                    <td class="am-text-middle"><?= $item['phone']?></td>
                                    <td class="am-text-middle"><?= $item['state']['text']?></td>
                                    <td class="am-text-middle"><?= $item['audit_time']?></td>
                                    <td class="am-text-middle"><?= $item['add_time']?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <?php if (checkPrivilege('user/review')): ?>
                                                <a class="j-delete tpl-table-black-operation-default isYes"
                                                   href="javascript:void(0);"
                                                   data-id="<?= $item['id'] ?>" title="通过">
                                                    <span name="<?= $item['id'] ?>"></span>
                                                    <i></i> 通过
                                                </a>
                                            <?php endif; ?>
                                            <?php if (checkPrivilege('user/review')): ?>
                                                <a class="j-delete tpl-table-black-operation-default isNo"
                                                   href="javascript:void(0);"
                                                   data-id="<?= $item['id'] ?>" title="否决">
                                                    <span name="<?= $item['id'] ?>"></span>
                                                    <i></i> 否决
                                                </a>
                                            <?php endif; ?>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="13" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?= $list->render() ?> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(".isYes").on("click",function () {
        var $this = $(this);
        var a = $this.data('id');

        layer.confirm('确定要通过吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "index.php?s=/store/user/isYes",
                data: {is:a},
                dataType: "json",
                success: function(data){
                    console.log(data);
                    window.setTimeout(function () {
                        window.location.reload();
                    },1200);
                    layer.msg(data.msg,{icon:1,time:1200});
                }
            });
            layer.close(index);
        });

    });

    $(".isNo").on("click",function () {
        var $this = $(this);
        var b = $this.data('id');
        layer.confirm('确定要否决吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "index.php?s=/store/user/isNo",
                data: {is:b},
                dataType: "json",
                success: function(data){
                    console.log(data);
                    window.setTimeout(function () {
                        window.location.reload();
                    },1200);
                    layer.msg(data.msg,{icon:1,time:1200});
                }
            });
            layer.close(index);
        });

    })
</script>


